//
//  GQRecommandCellButton.m
//  MyMusic
//
//  Created by sunny on 16/4/14.
//  Copyright © 2016年 sunny. All rights reserved.
//

#import "GQRecommandCellButton.h"

@implementation GQRecommandCellButton

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addCenterLabel];
    }
    return self;
}

- (void)awakeFromNib
{
    [self addCenterLabel];
}

#pragma mark - 添加子控件
- (void)addCenterLabel
{
    UILabel *label = [[UILabel alloc]init];
    self.centerLabel = label;
    label.textColor = [UIColor colorWithRed:0 green:187 / 255.0 blue:246 / 255.0 alpha:1];
    [self addSubview:label];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
//    设置图片的frame
    self.imageView.gq_width = 50;
    self.imageView.gq_height = 50;
    self.imageView.gq_y = 0;
    self.imageView.gq_centerX = self.gq_width * 0.5;
    
//    设置中间label的frame
    [self.centerLabel sizeToFit];
    self.centerLabel.center = self.imageView.center;
    
    // 根据文字内容计算下label,设置好label尺寸
    [self.titleLabel sizeToFit];
    self.titleLabel.gq_centerX = self.gq_width * 0.5;
    self.titleLabel.gq_y = self.gq_height - self.titleLabel.gq_height - 10 ;
    
    
}


@end
